-
-
Notifications
You must be signed in to change notification settings - Fork 357
Make turbo stream format subscriber opt-in and not enabled automatically #214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
In my opinion, symfony/symfony#44980 is a better fix. It should allow removing this listener entirely. |
@dunglas when then:
Can be removed from this listener I'm totally in for that change :) |
Tested your changes with sulu (without symfony/ux): $request->getPreferredFormat(); // turbo_stream
$request->getRequestFormat(); // html This would match my expected behaviour 👍 and would so not longer crash sulu's website controller here for turbo requests. |
Maybe should we merge symfony/symfony#44980 as a bug fix in Symfony then, to not have to wait for 6.1 to be released. |
@dunglas that would be great :) |
Well, symfony/symfony#44980 really is a feature... I'm for merging both PRs. We can remove the listener once this package supports 6.1+ only, as usual. |
Actually it's a bug fix for Turbo. The question is: do we merge fixes needed for Symfony UX in the maintenance branches of the monorepo. In my opinion, we should at least in this case as this patch is very very small and cannot break anything. |
@alexander-schranz could you try this patch instead, please? #217 |
Closing in favor of #217 |
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Turbo] Simplify stream negotiation | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Tickets | n/a | License | MIT This patch replaces the ad-hoc content negotiation system for Turbo Streams used by the bundle. HttpFoundation's native content negotiation features are now used instead. This greatly simplifies the code, which is security-sensitive, and improves DX (content negotiation is now consistent with how it is handled in the rest of the framework). Replaces #214. Needs #215 and symfony/symfony#44980. Commits ------- b6de1e3 [Turbo] Simplify stream negotiation
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Turbo] Simplify stream negotiation | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Tickets | n/a | License | MIT This patch replaces the ad-hoc content negotiation system for Turbo Streams used by the bundle. HttpFoundation's native content negotiation features are now used instead. This greatly simplifies the code, which is security-sensitive, and improves DX (content negotiation is now consistent with how it is handled in the rest of the framework). Replaces symfony/ux#214. Needs symfony/ux#215 and symfony/symfony#44980. Commits ------- b6de1e3 [Turbo] Simplify stream negotiation
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Turbo] Simplify stream negotiation | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Tickets | n/a | License | MIT This patch replaces the ad-hoc content negotiation system for Turbo Streams used by the bundle. HttpFoundation's native content negotiation features are now used instead. This greatly simplifies the code, which is security-sensitive, and improves DX (content negotiation is now consistent with how it is handled in the rest of the framework). Replaces symfony/ux#214. Needs symfony/ux#215 and symfony/symfony#44980. Commits ------- b6de1e3 [Turbo] Simplify stream negotiation
This PR was squashed before being merged into the 2.x branch. Discussion ---------- [Turbo] Simplify stream negotiation | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes <!-- please update src/**/CHANGELOG.md files --> | Tickets | n/a | License | MIT This patch replaces the ad-hoc content negotiation system for Turbo Streams used by the bundle. HttpFoundation's native content negotiation features are now used instead. This greatly simplifies the code, which is security-sensitive, and improves DX (content negotiation is now consistent with how it is handled in the rest of the framework). Replaces symfony/ux#214. Needs symfony/ux#215 and symfony/symfony#44980. Commits ------- b6de1e3 [Turbo] Simplify stream negotiation
The subscriber should be opt-in. As it currently manipulates the requestFormat which is not expected by all applications (e.g. Sulu or any other application, working with $request->getRequestFormat() for getting its template). A controller handling the turbo can activate the listener with:
This indicates this routes handles turbo route and so request format is set to turbo, for all other routes it behaves the symfony way and the request format is not manipulated in this case.